<template>
  <a-card>

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
    <a-form layout="inline" @keyup.enter.native="searchQuery">
      <a-row :gutter="24">
        <a-col :xl="6" :lg="7" :md="8" :sm="24">
          <a-form-item label="标题">
            <a-input placeholder="请输入标题" v-model="queryParam.title"></a-input>
          </a-form-item>
        </a-col>
        <a-col :xl="9" :lg="12" :md="12" :sm="36">
          <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
          <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px">查询</a-button>
          <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
        </a-col>
      </a-row>
    </a-form>
  </div>


<div>
  <a-table
    ref="table"
    rowKey="id"
    :columns="columns"
    :dataSource="dataSource"
    :pagination="ipagination"
    :loading="loading"
    @change="handleTableChange"
    style="width: 100%">
    <!-- 其他列定义 -->
    <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
  </a-table>
</div>

    <!-- 表单区域 -->
    <Industry-InformationModel ref="modalForm" @ok="modalFormOk"></Industry-InformationModel>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import IndustryInformationModel from '@views/mpMini/modules/IndustryInformationModel.vue'
import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil'

export default {
  name: "IndustryInformation",
  mixins: [JeecgListMixin],
  components: {
    IndustryInformationModel
  },
  methods: {
  },
  data() {
    return {
      description: '培训教程管理页面',
      queryParam:{
        category: 2,
      },
      modalVisible: false, // 控制模态框显示与否
      modalContent: '', // 模态框中要显示的内容
      columns: [
        {
          title: '标题',
          align:"center",
          dataIndex: 'title',
        },
        {
          title: '创建时间',
          align:"center",
          dataIndex: 'createtime',
        },
        // {
        //   title: '类型',
        //   align:"center",
        //   dataIndex: 'type',
        //  //customRender: (text) => {
        //   //return filterDictTextByCache('informationType', text)
        //   //},
        // },
        {
          title: '点赞数',
          align:"center",
          dataIndex: 'likes',
        },
        {
          title: '浏览数',
          align:"center",
          dataIndex: 'view',
        },
        {
          title: '操作',
          align: "center",
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' } // 定义一个名为 'action' 的插槽
        }  ],
      url: {
        list: "/mpMini/carinformation/list",
        delete: "/mpMini/carinformation/delete",
        deleteBatch: "/mpMini/carinformation/deleteBatch",
        check: "/mpMini/carinformation/queryById"
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
}
</script>

<style scoped>
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
  z-index: 1000; /* 确保遮罩层位于其他元素之上 */
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>